<?php
// +---------------------------------------------------------------------+
// | OneBase    | [ WE CAN DO IT JUST THINK ]                            |
// +---------------------------------------------------------------------+
// | Licensed   | http://www.apache.org/licenses/LICENSE-2.0 )           |
// +---------------------------------------------------------------------+
// | Author     | Bigotry <3162875@qq.com>                               |
// +---------------------------------------------------------------------+
// | Repository | https://gitee.com/Bigotry/OneBase                      |
// +---------------------------------------------------------------------+

namespace app\index\controller;

/**
 * 财务控制器
 */
class Moneyapp extends IndexBase
{ 
    /**
     * 提现列表
     */
    public function moneyappList()
    {
        $where = $this->logicMoneyapp->getWhere($this->param);
        $list=$this->logicMoneyapp->getMoneyappList($where);
        $this->assign('list',$list );       
        return $this->fetch('moneyapp_list');
    }
    /**
     * 套餐购买列表
     */
    public function seriesOrder()
    {
        $data=$this->param;
        $where = [];
        $where['m.stat'] = 1;
        !empty($data['user_id']) && $where['m.user_id'] = $data['user_id'];
        !empty($data['pay']) && $where['m.pay'] = $data['pay'];
        !empty($data['search_data']) && $where['m.order_sn|b.name|b.username'] = ['like', '%'.$data['search_data'].'%'];
        $list=$this->logicMoneyapp->getSeriesOrderList($where);
        $zfb=db('series_order')->field('sum(money) as zfbmoney')->where(array('stat'=>1,'pay'=>2))->find();
        $wx=db('series_order')->field('sum(money) as wxmoney')->where(array('stat'=>1,'pay'=>3))->find();
        $this->assign('list',$list );
        $this->assign('zfb',$zfb['zfbmoney']?$zfb['zfbmoney']:0);
        $this->assign('wx',$wx['wxmoney']?$wx['wxmoney']:0);
        return $this->fetch('seriesorder');
    }
    /**
     * 提现导出
     */
    public function exportMoneyappList()
    {
        
        $where = $this->logicMoneyapp->getWhere($this->param);
        
        $this->logicMoneyapp->exportMoneyappList($where);
    }
	/**
     * 数据状态设置
     */
    public function setStatus()
    {
        
        $this->jump($this->logicAdminBase->setStatus('user', $this->param));
    }
	/**
     * 数据状态设置
     */
    public function updateStat()
    {
        
        echo $this->logicMoneyapp->updateStat($this->param);
    }
}
